package Hangman;
/**
 * Letter class, used for each Character(of String) in a Word object.
 * @author Robin E, Jakob L, Isac A, Cristian O, Eric P, Tobias W. 
 *
 */
public class Letter {
	
	private boolean hidden;
	private String Sletter;
	
	/**
	 * Letter() Simple constructor which set the specific letter to an empty string
	 */
	public Letter()
	{
		this.Sletter = "";
	}
	/**
	 * Letter(String s) Simple constructor which set the specific letter to the argument which is being
	 * sent in.
	 * @param s the Letter to change to, if space then don't hide the letter, otherwise do hide it.
	 */
	public Letter(String s)
	{
		if(s.equalsIgnoreCase(" "))
		{
			Sletter = " ";
			hidden = false;
		}
		else
		{
			Sletter = s;
			hidden = true;
		}
	}
	/**
	 * turn(), used for turning the specific letter around, if it is hidden, make it shown and the opposite.
	 */
	public void turn()
	{
		if(hidden == true)
		{
			hidden = false;
		}
		else
		{
			hidden = true;
		}
	}
	/**
	 * setLetterS(String s) is used to change the letter to another string
	 * @param s the String to change to.
	 */
	public void setLetterS(String s)
	{
		Sletter = s;
	}
	/**
	 * getLetterS() is used to return the String of the letter
	 * @return Sletter the String of the letter.
	 */
	public String getLetterS()
	{
		return Sletter;
	}
	/**
	 * getHidden() is used to return the boolean of hidden
	 * @return hidden the hidden boolean to be returned
	 */
	public boolean getHidden()
	{
		return hidden;
	}
	/**
	 * toString()
	 * Returns different Strings depending on hidden boolean.
	 * If hidden, return '_' else return the String.
	 */
	public String toString()
	{
		if(hidden == true)
		{
			return "_";
		}
		else
		{
			return Sletter;
		}
	}
}
